package com.flismax.mysms.sendsms;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;

public class SmsReceive extends BroadcastReceiver {

	private String phoneNumberSendSMS = "";
	private String messageBody = "";

	@Override
	public void onReceive(Context context, Intent intent) {
		Bundle bundle = intent.getExtras();
		SmsMessage[] messages = null;
		if (bundle != null) {
			Object[] pdus = (Object[]) bundle.get("pdus");
			messages = new SmsMessage[pdus.length];
			for (int i = 0; i < messages.length; i++) {
				messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
				messageBody = messages[i].getMessageBody();
				phoneNumberSendSMS = messages[i].getOriginatingAddress();
			}
		}
	}

}
